// 查包商银行股份有限公司的关联事件
const getAssociateEvent = (req, res) => {
  let data = req.query.query
    ? {
        code: 0,
        msg: '',
        data: {
          eventList: [
            {
              nodes: [
                {
                  id: 'MSSL-001',
                  name: '商业贿赂不正当纠纷',
                  category: 'event',
                },
                {
                  id: '0000ea6b-5b8e-4867-9eb3-beee0f3c4300',
                  name: '广元远景商贸有限公司',
                  category: 'E',
                },
                {
                  id: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
                  name: '包商银行股份有限公司',
                  category: 'E',
                },
                {
                  id: '1234ea6b-5b8e-4867-9eb3-beee0f3c5678',
                  name: '长春经济技术开发区人民法院',
                  category: 'G',
                },
                {
                  id: '1545177600000',
                  name: '2018-12-19',
                  category: 'T',
                },
              ],
              links: [
                {
                  source: 'MSSL-001',
                  target: '0000ea6b-5b8e-4867-9eb3-beee0f3c4300',
                  label: '原告',
                },
                {
                  source: 'MSSL-001',
                  target: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
                  label: '被告',
                },
                {
                  source: 'MSSL-001',
                  target: '1234ea6b-5b8e-4867-9eb3-beee0f3c5678',
                  label: '裁判法院',
                },
                {
                  source: 'MSSL-001',
                  target: '1545177600000',
                  label: '日期',
                },
              ],
              type: '民事诉讼',
              date: '2018-12-19',
            },
          ],
        },
      }
    : {
        code: 0,
        msg: '',
        data: null,
      };
  res.json(data);
};

// 查包商银行股份有限公司的关联实体
const getAssociateEntity = (req, res) => {
  //console.log('call getAssociate',req.query)
  let data =
    req.query?.centerID === '8654ea6b-5b8e-2546-9eb3-bana0f3c9654'
      ? {
          code: 0,
          msg: '',
          data: {
            nodes: [
              {
                id: '123456',
                name: 'hahaha',
                category: 'E',
              },
              {
                id: '456789',
                name: 'hehehe',
                category: 'P',
              },
              {
                id: '8654ea6b-5b8e-2546-9eb3-bana0f3c9654',
                name: '李四',
                category: 'P',
              },
            ],
            links: [
              {
                source: '8654ea6b-5b8e-2546-9eb3-bana0f3c9654',
                target: '123456',
                label: '投资',
              },
              {
                source: '8654ea6b-5b8e-2546-9eb3-bana0f3c9654',
                target: '456789',
                label: '产业下游',
              },
            ],
          },
        }
      : {
          code: 0,
          msg: '',
          data: {
            nodes: [
              {
                id: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
                name: '包商银行股份有限公司',
                category: 'E',
              },
              {
                id: '00001b69-d265-40d2-affa-a527aaa1a000',
                name: '石家庄唐斯诺光电科技有限公司',
                category: 'E',
              },
              {
                id: '0000ea6b-5b8e-4867-9eb3-beee0f3c4300',
                name: '广元远景商贸有限公司',
                category: 'E',
              },
              {
                id: '8888ea6b-5b8e-4867-9eb3-beee0f3c6666',
                name: '张三',
                category: 'P',
              },
              {
                id: '8654ea6b-5b8e-2546-9eb3-bana0f3c9654',
                name: '李四',
                category: 'P',
              },
            ],
            links: [
              {
                source: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
                target: '00001b69-d265-40d2-affa-a527aaa1a000',
                label: '投资',
              },
              {
                source: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
                target: '0000ea6b-5b8e-4867-9eb3-beee0f3c4300',
                label: '产业下游',
              },
              {
                source: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
                target: '8888ea6b-5b8e-4867-9eb3-beee0f3c6666',
                label: '董事',
              },
              {
                source: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
                target: '8654ea6b-5b8e-2546-9eb3-bana0f3c9654',
                label: '总经理',
              },
            ],
          },
        };
  res.json(data);
};

// 包商银行股份有限公司 -> 广元远景商贸有限公司
const getAssociatePath = (req, res) => {
  console.log('this is req.query', req.query);
  let data = req.query
    ? {
        code: 0,
        msg: '',
        data: {
          nodes: [
            {
              id: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
              name: '包商银行股份有限公司',
              category: 'E',
            },
            {
              id: '00001b69-d265-40d2-affa-a527aaa1a000',
              name: '石家庄唐斯诺光电科技有限公司',
              category: 'E',
            },
            {
              id: '0000ea6b-5b8e-4867-9eb3-beee0f3c4300',
              name: '广元远景商贸有限公司',
              category: 'E',
            },
            {
              id: '8888ea6b-5b8e-4867-9eb3-beee0f3c6666',
              name: '张三',
              category: 'P',
            },
          ],
          links: [
            {
              source: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
              target: '00001b69-d265-40d2-affa-a527aaa1a000',
              label: '持股25%',
              date: '2018-12-19',
            },
            {
              source: '00001b69-d265-40d2-affa-a527aaa1a000',
              target: '8888ea6b-5b8e-4867-9eb3-beee0f3c6666',
              label: '董事',
              date: '2018-12-19',
            },
            {
              source: '0000ea6b-5b8e-4867-9eb3-beee0f3c4300',
              target: '8888ea6b-5b8e-4867-9eb3-beee0f3c6666',
              label: '法人',
              date: '2018-12-19',
            },
          ],
          pathList: [
            {
              links: [
                {
                  source: '4d3df93c-6113-4c1c-85fe-3dc7d6f1aa0d',
                  target: '00001b69-d265-40d2-affa-a527aaa1a000',
                  label: '持股25%',
                  date: '2018-12-19',
                },
                {
                  source: '00001b69-d265-40d2-affa-a527aaa1a000',
                  target: '8888ea6b-5b8e-4867-9eb3-beee0f3c6666',
                  label: '董事',
                  date: '2018-12-19',
                },
                {
                  source: '0000ea6b-5b8e-4867-9eb3-beee0f3c4300',
                  target: '8888ea6b-5b8e-4867-9eb3-beee0f3c6666',
                  label: '法人',
                  date: '2018-12-19',
                },
              ],
            },
          ],
        },
      }
    : {
        code: 0,
        msg: '',
        data: null,
      };
  res.json(data);
};

export default {
  'GET /api/associateEvent': getAssociateEvent,
  'GET /api/associateEntity': getAssociateEntity,
  'GET /api/associatePath': getAssociatePath,
};
